var db = {
  //员工
  staff: [
    {
      id: 1,
      name: "张三",
      sex: "男",
      //部门
      department: 1,
      //职务
      post: 0,
      phone: 19999999999,
      //密码
      password: 123456,
      //备注
      remarks: "",
      //业绩目标
      achievement: {},
      //邮箱
      e_mail: 888,
      birthday: "2000-01-2",
    },
    {
      id: 2,
      name: "李四",
      sex: "男",
      //部门
      department: 1,
      //职务
      post: 0,
      phone: 18888888888,
      //密码
      password: 123456,
      //备注
      remarks: "",
      //业绩目标
      achievement: {},
      //邮箱
      e_mail: 888,
      birthday: "2000-01-2",
    },
    {
      id: 3,
      name: "王五",
      sex: "男",
      //部门
      department: 1,
      //职务
      post: 0,
      phone: 17777777777,
      //密码
      password: 123456,
      //备注
      remarks: "",
      //业绩目标
      achievement: {},
      //邮箱
      e_mail: 888,
      birthday: "2000-01-2",
    },
    {
      id: 4,
      name: "赵六",
      sex: "女",
      //部门
      department: 1,
      //职务(组长0，组员1)
      post: 0,
      phone: 16666666666,
      //密码
      password: 123456,
      //备注
      remarks: "",
      //业绩目标
      achievement: {},
      //邮箱
      e_mail: 888,
      birthday: "2000-01-2",
    },
  ],
  //部门
  department: [
    {
      //部门编号
      id: 1,
      name: "销售部",
      //责任人(员工id)
      person_liable: 1,
      //上级部门
      superior_department: 1,
      remarks: "",
    },
    {
      id: 2,
      name: "销售一组",
      //责任人(员工id)
      person_liable: 2,
      //上级部门
      superior_department: 1,
      remarks: "",
    },
    {
      id: 3,
      name: "销售二组",
      //责任人(员工id)
      person_liable: 3,
      //上级部门
      superior_department: 1,
      remarks: "",
    },
  ],
  //产品
  product: [
    {
      id: 001,
      name: "单人床",
      //单价
      unit_price: 1000,
      //规格
      specifications: "套",
      remarks: "",
    },
    {
      id: 002,
      name: "双人床",
      //单价
      unit_price: 1500,
      //规格
      specifications: "件",
      remarks: "",
    },
    {
      id: 003,
      name: "优质上下床",
      //单价
      unit_price: 1600,
      //规格
      specifications: "组",
      remarks: "",
    },
  ],
  //公告
  announcement: [
    {
      //遍历依据
      id: 0,
      //标题
      title: 1,
      //发布人
      issuer: 1,
      //发布时间
      time: 1,
      //发布内容
      content: 1,
    },
  ],
  //客户
  connection: [
    {
      //隐藏属性，添加自增，用户无法直接修改
      id: 1,
      //客户名称
      name: "",
      //对接人
      counterpart: 1,
      //客户来源
      source: 1,
      //客户标签
      customer_label: 1,
      //客户类型
      type: 1,
      //简介
      remarks: 1,
      //
    },
  ],
  //合同
  agreement: [
    {
      id: 1,
      name: "",
      //合同来自的客户(存客户id)
      connection: 1,
      //签约日期
      date: "",
      //是否逾期(默认为false，逾期就为true)
      exceed: false,
      //状态(已保存、待审核、已审核，已驳回四选一)
      status: "已签约",
    },
  ],
};
//判定浏览器是否有缓存
if (localStorage.getItem("db")) {
  //有缓存，调用缓存
  db = JSON.parse(localStorage.getItem("db"));
} else {
  //没缓存上传数据
  localStorage.setItem("db", JSON.stringify(db));
}
function asyncLocalStory() {
  localStorage.setItem("db", JSON.stringify(db));
}

let staff = db.staff; //员工
let department = db.department; //部门
let product = db.product; //产品
let connection = db.connection; //客户
let announcement = db.announcement; //公告
let agreement = db.agreement; //合同
